package com.yami.shop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yami.shop.bean.model.Config;
import com.yami.shop.dao.ConfigMapper;
import com.yami.shop.service.ConfigService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * @author lgh
 */
@Service("configService")
@AllArgsConstructor
public class ConfigServiceImpl extends ServiceImpl<ConfigMapper, Config> implements ConfigService {

    private final ConfigMapper configMapper;

    @Override
    public void updateValueByKey(String key, String value) {
        configMapper.updateValueByKey(key, value);
    }

    @Override
    public void deleteBatch(Long[] ids) {
        configMapper.deleteBatch(ids);
    }

    @Override
    public String getValue(String key) {
        Config config = configMapper.queryByKey(key);
        return config == null ? null : config.getParamValue();
    }
}

